<?php
/*
 * General Functions
 * 
 * Mainly used functions
 * 
 * @author : Jason Meulenhoff
 * @mail : mail@kacangboi.com
 * @web : http://kacangboi.com
 * @copyright : KacangNetworks 2010
 * 
 */

function generateVideoList($data)
{
	$newDate = array();
	$string = null;
	sort($data);
	foreach($data as $part)
	{
		switch($part['language'])
		{
			case "EN" :
				$lang = "<img src='../images/uk.png'/>";
			break;
			case "NL" :
				$lang = "<img src='../images/nl.png'/>";
			break;
		}
		if(!in_array($part['date'],$newDate))
		{
			$string .= '</br>';
			array_push($newDate,$part['date']);
			$string .= "<p class='videoOnDemandWatchingText'>Sessions from ". substr($part['date'],0,2). "-" . substr($part['date'],2,4) . "-". date('y') . "</p>";
			$string .= "<span style='font-size : 14px;'>". $lang . " " . $part['name'] . " | <a href='view.controller.php?file=".$part['name']."'>View</a> | Download</span>";
		}
		else
		{
			$string .= "<br>";
			$string .= "<span style='font-size : 14px;'>". $lang . " " . $part['name'] . " | <a href='view.controller.php?file=".$part['name']."'>View</a> | Download</span>";
			$string .= '</br>';
		}
	}	
	return $string;
}
?>